<style>
#shifitingListPage .searchContent li span.error {
    float: right;
    margin-right: 7px;
}
</style>
<div id="shifitingListPage">
    <div class="pageContent" id="jGridForShifting"></div>
</div>
<script type="text/javascript">
(function($, win){
    var $page = DWZ.context(), $grid = $('#jGridForShifting', $page), dateFmt = 'yyyy-MM-dd', 
    today = new Date().formatDate(dateFmt), dateTimeFmt = 'yyyy-MM-dd HH:mm';
    // 是否启用排班
    //var enableShift = ${enableShift};
    $grid.jGrid({
        layoutH: 164,
        base: hostUrl + '/shifting/',
        url: 'getShiftingList',
        width: 1400,
        columns: [
            {field: 'id', group: 'ids', type: 'checkbox', width: 22},
            {field: '_index', text: '<@label key="serialNumber.C">序号</@label>', width: 40},
            {field: 'personnelCode', text: '人员编号', width: 100, orderTable: 's'},
            {field: 'personnelName', text: '姓名', width: 60},
            {field: 'workcenterText', text: '工作中心', width: 100},
            {field: 'shiftingWorkcenterText', text: '<@label key="shiftingWorkCenter.C">实际工作中心</@label>', width: 100},
            {field: 'theDate', type: 'date', format: dateFmt, text: '日期', width: 80},
            {field: 'startDateTime', type: 'date', format: dateTimeFmt, text: '开始时间', width: 120},
            {field: 'endDateTime', type: 'date', format: dateTimeFmt, text: '结束时间', width: 120},
            {field: 'createUser', text: '<@label key="createUser.C">创建人</@label>', width: 80, orderTable: 's'},
            {field: 'createDateTime', type: 'date', format: 'yyyy-MM-dd HH:mm:ss', text: '<@label key="createDateTime.C">创建时间</@label>', width: 120, orderTable: 's'},
            {field: 'modifyUser', text: '<@label key="modifyUser.C">修改人</@label>', width: 80, orderTable: 's'},
            {field: 'modifyDateTime', type: 'date', format: 'yyyy-MM-dd HH:mm:ss', text: '<@label key="modifyDateTime.C">修改时间</@label>', width: 120, orderTable: 's'}
        ],
        query: {
            numPerRow: 3,
            queryfields: [
                {field: 'personnelCode', text: '人员编号'},
                {field: 'workcenterCode', text: '工作中心', type: 'select', options: [
                    {value: '', label: '<@label key="all.C">所有</@label>'},
                    <#list permissions as permission>
                    {value: '${permission.workcenterCode}', label: '${permission.workcenterText}'},
                    </#list>
                ]},
                {},
                {field: 'theDateFrom', type: 'date', text: '日期', format: 'yyyy-MM-dd', css: 'from', dateGroup: 'theDate', value: today, required: true},
                {field: 'theDateTo', type: 'date', text: '到', format: 'yyyy-MM-dd', css: 'to', dateGroup: 'theDate', value: today, required: true}
            ],
            advancedqueryfields: [
                {field: 'personnelName', text: '姓名'},
                {field: 'shiftingWorkcenterCode', text: '<@label key="shiftingWorkCenter.C">实际工作中心</@label>', type: 'select', options: [
                    {value: '', label: '<@label key="all.C">所有</@label>'},
                    <#list permissions as permission>
                    {value: '${permission.workcenterCode}', label: '${permission.workcenterText}'},
                    </#list>
                ]},
                {field: 'memo', text: '备注'},
                {field: 'startDateTimeFrom', type: 'date', text: '开始时间', dateFmt: dateTimeFmt, css: 'from', dateGroup: 'startDateTime'},
                {field: 'startDateTimeTo', type: 'date', text: '到', dateFmt: dateTimeFmt, css: 'to', dateGroup: 'startDateTime'},
                {},
                {field: 'endDateTimeFrom', type: 'date', text: '结束时间', dateFmt: dateTimeFmt, css: 'from', dateGroup: 'endDateTime'},
                {field: 'endDateTimeTo', type: 'date', text: '到', dateFmt: dateTimeFmt, css: 'to', dateGroup: 'endDateTime'}
            ]
        },
        gridbars: [
            {icon: 'add', text: '<@label key="add.B">新增</@label>', title: '新增工作时段', 
                target: 'dialog', href: 'addShifting', data: {navTabId: "${navTabId!''}"}, mask: true, width: 950, height: 450, 
                menuCode: "shifting_add"},
            {icon: 'edit', text: '<@label key="edit.B">编辑</@label>', title: "编辑工作时段", 
                target: 'dialog', href: 'modifyShifting', data: {id: '{id}', navTabId: '${navTabId}'}, mask: true, width: 640, height: 320, rel: '', callback: $.noop,
                menuCode: "shifting_edit"},
            {icon: 'icon', text: '<@label key="view.B">详情</@label>', title: "工作时段详情", 
                target: 'dialog', href: 'viewShifting', data: {id: '{id}', navTabId: '${navTabId}'}, mask: true, width: 640, height: 400, rel: '', callback: $.noop,
                menuCode: "shifting_view"},
            {icon: 'delete', text: '<@label key="delete.B">删除</@label>', title: "确认要删除选择的工作时段数据吗？", 
                target: 'selectedTodo', href: 'deleteShiftings', data: {ids: '{ids}', navTabId: '${navTabId!""}'},
                menuCode: "shifting_del"},
            {icon: 'add', text: '<@label key="copy.B">复制</@label>', title: '复制工作时段', 
                target: 'dialog', href: 'copyShifting', data: {navTabId: "${navTabId!''}"}, mask: true, width: 950, height: 500, 
                menuCode: "shifting_copy"},
            {icon: 'add', text: '<@label key="batch.C,add.B">批量新增</@label>', title: '批量新增工作时段', 
                target: 'dialog', href: 'batchAddShifting', data: {navTabId: "${navTabId!''}"}, mask: true, width: 950, height: 500, 
                menuCode: "shifting_batch_add"}
        ]
    });
    if (!win.ShiftingCommon) {
        $.getScript('${rc.getContextPath()}/manage/js/businessJs/shifting_common.js');
    }
})(jQuery, window);
</script>
